.text
	.section	.rodata
.LC0:
	.string	"this is little endian"
.LC1:
	.string	"this is big endian"
	.text
	.globl	main
	.type	main, @function
main:
    pushq	%rbp
    movq	%rsp, %rbp

    subq $16, %rsp
    // s1: -2(%rbp)
    // first_c: -3(%rbp)

    movw $0x1234, -2(%rbp) /* s1 */
    leaq -2(%rbp) /* s1 */, %rax
    movb (%rax), %al
    movb %al, -3(%rbp) /* first_c */
    movb -3(%rbp) /* first_c */, %al
    cmpb $0x34, %al
    je .LITTLE_ENDIAN
    cmpb $0x12, %al
    je .BIG_ENDIAN
    jmp .EXIT_SUCCESS
.BIG_ENDIAN:
    leaq .LC1(%rip), %rdi
    movl $0, %eax
    call puts
    jmp .EXIT_SUCCESS
.LITTLE_ENDIAN:
    leaq .LC0(%rip), %rdi
    movl $0, %eax
    call puts
.EXIT_SUCCESS:
    movl $0, %eax
    leave
    ret